def printInfo():
    print ('------------------------------------')
    print ('         人生苦短，我用Python')
    print ('------------------------------------')


printInfo()


# 打印一条横线
def printOneLine():
    print("-" * 30)


# 打印多条横线
def printNumLine(num):
    i = 0

    # 因为printOneLine函数已经完成了打印横线的功能，
    # 只需要多次调用此函数即可
    while i < num:
        printOneLine()
        i += 1


printNumLine(3)


# 递归函数
def digui(num):
    if num > 1:
        res = num * digui(num - 1)
    else:
        res = 1
    return res

print (digui(5))

# 排序
stus = [
    {"name":"zhangsan", "age":18},
    {"name":"lisi", "age":19},
    {"name":"wangwu", "age":17}
]
print (stus)
stus.sort(key = lambda x:x['name'])
print (stus)
stus.sort(key = lambda x:x['age'])
print (stus)